from dotenv import load_dotenv, find_dotenv
from langchain_openai import ChatOpenAI
from langchain.prompts import PromptTemplate

_ = load_dotenv(find_dotenv())

template = PromptTemplate.from_template("给我讲个关于{subject}的笑话")
print("=================")
print(template)
print("=================")
print(template.format(subject="小明"))

llm = ChatOpenAI(model="gpt-4o")

response = llm.invoke(template.format(subject="小明"))
print(response.content)